import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/hts")

public class HttpTestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method =req.getMethod();//获取请求
        System.out.println("请求方式："+method);
        System.out.println("HttpTestServlet的doGet方法被执行了");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method =req.getMethod();//获取请求r
        System.out.println("请求方式："+method);
        System.out.println("HttpTestServlet的doPost方法被执行了");
    }

    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method =req.getMethod();//获取请求
        System.out.println("请求方式："+method);
        System.out.println("HttpTestServlet的doPut方法被执行了");
    }

    @Override
    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method =req.getMethod();//获取请求
        System.out.println("请求方式："+method);
        System.out.println("HttpTestServlet的doDelete方法被执行了");
    }
}
